#!/usr/bin/env python

import argparse
import sys
import os
import decimal
#sys.path.append("/Users/roosevelt/Desktop/bayes/trunk/modules/")
sys.path.append("/home/roosevelt/Desktop/bayes/trunk/modules/")
from BayesNetwork import BayesNetwork

parser = argparse.ArgumentParser(description='Compares two bayesian networks.')
parser.add_argument('-f', help='The first bn')
parser.add_argument('-s', help='The second bn')
parser.add_argument('-d', help='Dataset used to compute scores')
parser.add_argument('-c', help='The class variable used in the comparison. (CLL)')

args = parser.parse_args()
first = vars(args)['f']
second = vars(args)['s']
dataset = vars(args)['d']
class_variable = vars(args)['c']

BN = BayesNetwork()

variables,data =BN.loadDataset(dataset)
first_bn = BN.parse(first)
second_bn = BN.parse(second)
BN.showTime = False
BN.compareBNStructures(first_bn, second_bn, variables, data, class_variable, classification_threshold=decimal.Decimal("0.7"))

# comparebn -f ~/Desktop/bayes/trunk/data/ini_structures/child_ini_structure_net4.eg -s ~/Desktop/bayes/trunk/experiments/BBSL/bbsl_child_500_perc1_net1/0/alarm_final_structure.eg -d ~/Desktop/bayes/trunk/data/dataset/child_500_perc1_missing_data.txt -c "CO2"